<?php

namespace JsonLowCode\UI;

use JsonLowCode\Schema;
use JsonLowCode\Traits\Events\HasOnFinish;
use JsonLowCode\Traits\Props\HasActive;
use JsonLowCode\Traits\Props\HasAffix;
use JsonLowCode\Traits\Props\HasColor;
use JsonLowCode\Traits\Props\HasDuration;
use JsonLowCode\Traits\Props\HasLabel;
use JsonLowCode\Traits\Props\HasLocale;
use JsonLowCode\Traits\Props\HasMax;
use JsonLowCode\Traits\Props\HasShow;
use JsonLowCode\Traits\Props\HasType;
use JsonLowCode\Traits\Props\HasValue;
use JsonLowCode\Traits\Slots\HasSlotLabel;
use JsonLowCode\Traits\Slots\HasSlotPrefix;
use JsonLowCode\Traits\Slots\HasSlotSuffix;

/**
 * Statistic 统计数据组件
 * @method static Statistic make(string|int $value = null) Statistic组件
 */
class Statistic extends Schema
{
    protected string $componentName = "NStatistic";

    use HasLabel;

    use HasSlotLabel, HasSlotPrefix, HasSlotSuffix;

    /**
     * @param string|int|null $value
     */
    public function __construct(string|int $value = null)
    {
        parent::__construct();
        $this->prop('value', $value);
    }

    /**
     * 是否让数字等宽
     * @param string|bool $bool
     * @return $this
     */
    public function tabularNums(string|bool $bool = true): static
    {
        return $this->prop('tabularNums', $bool);
    }
}
